package cn.com.huzo.repository.master.impl;

import cn.com.huzo.model.entities.master.WareHouseLocationEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import org.springframework.stereotype.Repository;
import cn.com.huzo.repository.master.WareHouseLocationRepository;
import java.util.Map;

/**
 * 仓库库位数据访问对象。
 *
 * @author 吴旭
 */
@Repository("WareHouseLocationRepository")
public class WareHouseLocationRepositoryImpl extends GenericRepositoryImpl<WareHouseLocationEntity, String>
        implements WareHouseLocationRepository {

    private final String namespace = "cn.com.huzo.repository.master.WareHouseLocationRepository";

    /**
     * 构造函数,设置the instance to ProductRepositoryImpl.class.
     */
    public WareHouseLocationRepositoryImpl() {
        super(WareHouseLocationEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer fetchForCount(Map<String, Object> criterion) {
        return getSqlSession().selectOne(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchForCount"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<WareHouseLocationEntity> fetchForPage(Map<String, Object> criterion) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchForPage"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchInsert(List<WareHouseLocationEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchInsert"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchUpdate(List<WareHouseLocationEntity> itemsList) {
        return getSqlSession().update(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchUpdate"), itemsList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchDelete(List<WareHouseLocationEntity> itemList) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchDelete"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer delete(String key) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), key);
    }
}
